package com.example.service.hello;

import com.example.config.HelloConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author yuanzheng
 * @date 2020/7/26-18:13
 */
@Configuration
@ConditionalOnWebApplication
@EnableConfigurationProperties(HelloConfiguration.class)
public class HelloServiceAutoConfiguration {

    @Bean
    public HelloService helloService(HelloConfiguration helloProperties) {
        HelloService service = new HelloService();
        service.setHelloProperties(helloProperties);
        return service;
    }
}
